Trò chơi đua xe động vật trong UNITY Engine
114.631 lượt xem;
- ResultClickListener.cs
- Result /
- GameScreen /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4 public class ResultClickListener : InputAdapter {
5
6 public override void OnTouchDown()
7 {
8 if (InputController.Name != InputNames.DIALOG) return;
9 base.OnTouchDown();
10 gameObject.transform.localScale = new Vector3(0.9f, 0.9f, gameObject.transform.localScale.z);
11 SoundManager.playButtonSound();
12 }
13
14 public override void OnCheckUp()
15 {
16 if (InputController.Name != InputNames.DIALOG) return;
17 base.OnCheckUp();
18 gameObject.transform.localScale = new Vector3(1, 1, gameObject.transform.localScale.z);
19 }
20
21 public override void OnTouchUp()
22 {
23 if (InputController.Name != InputNames.DIALOG) return;
24 base.OnTouchUp();
25 switch(gameObject.name)
26 {
27 case "Bt_Menu":
28 Application.LoadLevel("MapScreen");
29 SoundManager.LoadBgMusic("Sounds/menu", true);
30 break;
31 case "Bt_Replay":
32 Application.LoadLevel("GameScreen");
33 break;
34 case "Bt_Next":
35 if (Attr.currentLevel == 14)
36 {
37 Application.LoadLevel("MapScreen");
38 }
39 else
40 {
41 Attr.currentLevel++;
42 Application.LoadLevel("ShopScreen");
43 SoundManager.LoadBgMusic("Sounds/menu", true);
44 }
45 break;
46 }
47 }
48
49 public void Start () {
50
51 }
52
53 public void Update () {
54
55 }
56 }
2 using System.Collections;
3
4 public class ResultClickListener : InputAdapter {
5
6 public override void OnTouchDown()
7 {
8 if (InputController.Name != InputNames.DIALOG) return;
9 base.OnTouchDown();
10 gameObject.transform.localScale = new Vector3(0.9f, 0.9f, gameObject.transform.localScale.z);
11 SoundManager.playButtonSound();
12 }
13
14 public override void OnCheckUp()
15 {
16 if (InputController.Name != InputNames.DIALOG) return;
17 base.OnCheckUp();
18 gameObject.transform.localScale = new Vector3(1, 1, gameObject.transform.localScale.z);
19 }
20
21 public override void OnTouchUp()
22 {
23 if (InputController.Name != InputNames.DIALOG) return;
24 base.OnTouchUp();
25 switch(gameObject.name)
26 {
27 case "Bt_Menu":
28 Application.LoadLevel("MapScreen");
29 SoundManager.LoadBgMusic("Sounds/menu", true);
30 break;
31 case "Bt_Replay":
32 Application.LoadLevel("GameScreen");
33 break;
34 case "Bt_Next":
35 if (Attr.currentLevel == 14)
36 {
37 Application.LoadLevel("MapScreen");
38 }
39 else
40 {
41 Attr.currentLevel++;
42 Application.LoadLevel("ShopScreen");
43 SoundManager.LoadBgMusic("Sounds/menu", true);
44 }
45 break;
46 }
47 }
48
49 public void Start () {
50
51 }
52
53 public void Update () {
54
55 }
56 }